﻿using OestsCommon.Model;
using System;
using System.Collections.Generic;
using System.Data;

namespace OestsDataBase
{
    public static class PaperOperateTaskDAL
    {

        public static List<TaskModel> GetTask_ID_ExamPostId_Scroe_InPaper(int paperID)
        {
            try
            {
                string strSql = string.Format("select * from  T_PaperOperate_{0} ", paperID);
                DataTable dt = SqlHelper.ExecuteDataTable(strSql);
                if (dt == null) { return null; }
                List<TaskModel> list = new List<TaskModel>();
                foreach (DataRow dr in dt.Rows)
                {
                    TaskModel tm = new TaskModel();
                    tm.Id = Int32.Parse(dr["task_id"].ToString());
                    tm.ExamPostId = Int32.Parse(dr["post_id"].ToString());
                    tm.StepScore = dr["score"].Equals(DBNull.Value) ? "" : dr["score"].ToString();
                    list.Add(tm);
                }
                return list;
            }
            catch (Exception E)
            {
                throw E;
            }
        }
    }
}
